package com.gzq.service;

import com.gzq.entity.Team;
import com.gzq.repository.TeamDao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class TeamService {
    @Resource
    TeamDao teamDao;
    public Page<Team> findAll(int nub){
        Pageable pageable =new PageRequest(nub, 12, Sort.Direction.ASC, "id");
        Page<Team> page=teamDao.findAll(pageable);
        return page;
    }
    /**
     * 通过status查找
     */
    public List<Team> findByStatus(String status){
        List<Team> list1=teamDao.findByStatus(status);
        return list1;
    }
    /**
     * 去重查找班级信息
     */
    public List findClass(){
        return teamDao.findDistinctByStatus();
    }

}
